/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.mc.sdk.portalcenter.api;

import cn.hallele.infrastructure.metadata.io.Response;
import cn.hallele.mc.sdk.portalcenter.dto.CaptchaDTO;
import cn.hallele.mc.sdk.portalcenter.dto.LoginResDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * hallele_mc_sdk
 *
 * @author anle5
 * @since 2024/10/5 23:32
 */
@Tag(name = "01.授权管理")
public interface AuthApi {
    /**
     * 生成验证码
     *
     * @return 验证码
     */
    @GetMapping("captcha")
    @Operation(summary = "生成验证码")
    Response<CaptchaDTO> createCaptcha();

    /**
     * 登录接口
     *
     * @param username    用户名
     * @param password    密码
     * @param captchaKey  验证码key
     * @param captchaCode 验证码值
     * @return LoginResDTO
     */
    @PostMapping("login")
    Response<LoginResDTO> login(@RequestParam("username") String username,
                                @RequestParam("password") String password,
                                @RequestParam("captchaKey") String captchaKey,
                                @RequestParam("captchaCode") String captchaCode);

    /**
     * 注销登录
     *
     * @return 空
     */
    @GetMapping("logout")
    Response<Void> logout();
}
